<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
    var str= '';
    for (var i = 1;i <= 5;i++){
        str = str + '☆';
    }
    console.log(str);
    var num=prompt('请输入星星的个数');
    var str2='';
    for (var i = 1;i <= num;i++){
        str2 = str2 + '☆';
    }
    console.log(str2);
</script>
<body>

</body>
</html>